package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/6/25.
 */
@HttpInlet(Conn.INLET_API_INSURANCE_COMPULSORY_OFFER)
public class GetApiInsuranceBaoJia extends BaseAsyGet<GetApiInsuranceBaoJia.Info> {
    public String cid , regTime, useType, carType;

    public GetApiInsuranceBaoJia(AsyCallBack<GetApiInsuranceBaoJia.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {
        TOAST = jsonObject.optString("message");
        if (jsonObject.optInt("code") == 200) {
            Info info = new Info();
            Data d = new Data();

            JSONObject o = jsonObject.optJSONObject("data");
            d.id = o.optString("id");
            d.picurl = Conn.PIC + o.optString("picurl");
            d.title = o.optString("title");
            d.premium = o.optString("premium");
            d.relief = o.optString("relief");

            info.data = d;
            return info;
        }
        return null;
    }

    public static class Info {
        public String code, message;
        public Data data;
    }

    public static class Data {
        //        "id": "1",
//                "picurl": "N;",
//                "title": "平安保险",
//                "premium": "3600.00",
//                "relief": 720
        public String id, picurl, title, premium, relief;
    }
}
